package cn.edu.scau.cmi.chenjia.clientFxml;

import java.net.URL;
import java.util.ResourceBundle;


import cn.edu.scau.cmi.chenjia.client.*;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;

import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
import javafx.scene.control.ComboBox;

public class ComprehensiveExperimentUIController implements Initializable {
	@FXML
	private Label l1;
	@FXML
	private Label l2;
	@FXML
	private Label l4;
	@FXML
	private ComboBox cb;
	@FXML
	private Button bt;
	@FXML
	private Label l3;
	@FXML
	private Label l5;

	@Override
	public void initialize(URL arg0, ResourceBundle arg1) {
		ImageView imageView = new ImageView("201727010201+陈嘉.jpg");
		imageView.setFitHeight(200);
		imageView.setFitWidth(200);
		l1.setGraphic(imageView);
		
		cb.setValue("第一次实验:接口编程");
		cb.setItems(FXCollections.observableArrayList("第一次实验:接口编程", "第二次实验:单例模式","第二次实验:多例模式", "第三次实验:工厂模式", "第四次实验:适配器模式", "第五次实验:安全组合模式","第五次实验:一致性组合模式", "第六次实验:Hibernate", "第七次实验:Spring"));
	}

	public void button() {
		String a = (String) cb.getValue();
		if (a == "第一次实验:接口编程") {
			InterProgrammingClient one=new InterProgrammingClient();
			one.start(new Stage());
		} 
		else if (a == "第二次实验:单例模式") {
			SingletonClient two = new SingletonClient();
			two.start(new Stage());
		}
		else if (a == "第二次实验:多例模式") {
			MutipletonClient two = new MutipletonClient();
			two.start(new Stage());
		}
		else if (a == "第三次实验:工厂模式") {
			AllFactoryMethodClient three = new AllFactoryMethodClient();
			three.start(new Stage());
		}
		else if (a == "第四次实验:适配器模式") {
			AdapterClient four = new AdapterClient();
			four.start(new Stage());
		}
		else if (a == "第五次实验:安全组合模式") {
			SafeOrganizationClient five1 = new SafeOrganizationClient();
			five1.start(new Stage());
		}
		else if (a == "第五次实验:一致性组合模式") {
			ConsistentOrganizationClient five2 = new ConsistentOrganizationClient();
			five2.start(new Stage());
		}
		else if (a == "第六次实验:Hibernate") {
			HibernateDaoClient six = new HibernateDaoClient();
			six.start(new Stage());
		}
		else if (a == "第七次实验:Spring") {
			SpringHibernateClient seven = new SpringHibernateClient();
			seven.start(new Stage());
		}
	}
}
